﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Model="clr-namespace:NMortgage.UI.Model"
                    xmlns:Properties="clr-namespace:NMortgage.UI.Properties">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Themes/CommonStyles.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <Style TargetType="Label">
        <Setter Property="Width"
                Value="120" />
    </Style>
    <Style x:Key="Row"
           TargetType="StackPanel">
        <Setter Property="Margin"
                Value="0 0 0 10" />
        <Setter Property="Orientation"
                Value="Horizontal" />
        <Setter Property="MinWidth"
                Value="260" />
        <Setter Property="HorizontalAlignment"
                Value="Stretch" />
    </Style>
    
    <DataTemplate DataType="{x:Type Model:PaymentFrequency}">
        <TextBlock Text="{Binding Converter={StaticResource enumToResourceConverter}, ConverterParameter={x:Static Properties:Resources.ResourceManager}}" />
    </DataTemplate>
    <DataTemplate DataType="{x:Type Model:DistributionType}">
        <TextBlock Text="{Binding Converter={StaticResource enumToResourceConverter}, ConverterParameter={x:Static Properties:Resources.ResourceManager}}" />
    </DataTemplate>
    <DataTemplate DataType="{x:Type Model:ExtraPaymentType}">
        <TextBlock Text="{Binding Converter={StaticResource enumToResourceConverter}, ConverterParameter={x:Static Properties:Resources.ResourceManager}}" />
    </DataTemplate>
    <DataTemplate DataType="{x:Type Model:ExtraPaymentFrequency}">
        <TextBlock Text="{Binding Converter={StaticResource enumToResourceConverter}, ConverterParameter={x:Static Properties:Resources.ResourceManager}}" />
    </DataTemplate>

    <Style x:Key="RadioListStyle"
           TargetType="ListBox">
        <Setter Property="SelectionMode"
                Value="Single" />
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="ListBoxItem">
                    <Setter Property="SnapsToDevicePixels"
                            Value="true" />
                    <Setter Property="OverridesDefaultStyle"
                            Value="true" />
                    <Setter Property="VerticalAlignment"
                            Value="Center" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ListBoxItem">
                                <RadioButton IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}"
                                             Margin="0 0 5 0">
                                    <RadioButton.Content>
                                        <ContentPresenter />
                                    </RadioButton.Content>
                                </RadioButton>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <ItemsPresenter />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>